package jpa.Model;

import javax.persistence.*;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: Pavlo
 * Date: 30.01.12
 * Time: 16:08
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "Protocol")
@Access(AccessType.PROPERTY)
public class Protocol extends ID{

    private District district;

    private ProtocolType type;

    private Set<VoteResult> voteResults;

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "ID", referencedColumnName = "ID")
    public District getDistrict() {
        return district;
    }

    public void setDistrict(District district) {
        this.district = district;
    }

    @ManyToOne
    @JoinColumn(name = "type", referencedColumnName = "ID")
    public ProtocolType getType() {
        return type;
    }

    public void setType(ProtocolType type) {
        this.type = type;
    }

    @OneToMany
    @JoinColumn(name = "protocol")
    public Set<VoteResult> getVoteResults() {
        return voteResults;
    }

    public void setVoteResults(Set<VoteResult> voteResults) {
        this.voteResults = voteResults;
    }
}
